home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5483 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!eskimo!scs
  3. From: scs@eskimo.com (Steve Summit)
  4. Subject: Re: void main() and other atrocities!
  5. X-Nntp-Posting-Host: eskimo.com
  6. Message-ID: <DMHDJs.GrI@eskimo.com>
  7. Sender: news@eskimo.com (News User Id)
  8. Organization: schmorganization
  9. References: <4erjn2INN38b@keats.ugrad.cs.ubc.ca> <9602021300.AA04359@dxmint.cern.ch> <4f5vc2$qcj@cdn_news.telecom.com.au>
  10. Date: Thu, 8 Feb 1996 23:35:52 GMT
  11.  
  12. In article <4f5vc2$qcj@cdn_news.telecom.com.au>, jolson@vprpmel1.telecom.com.au
  13. (Jeff Olson) writes:
  14. > How about:
  15. >    int main (int argc, char **argv)
  16. > I saw in the FAQ that a multi-dimentional array will not decay into
  17. > a pointer to a pointer.
  18.  
  19. Right.
  20.  
  21. > This main() is valid with my Sparcworks compiler so I would like to
  22. > know if my compiler is supporting non-standard behavior
  23.  
  24. Not at all (not on this score, anyway).
  25.  
  26. > or if argv is a pointer to an array of characters...
  27.  
  28. Almost.
  29.  
  30. Up in main's caller, argv is either a pointer to some pointers to
  31. some characters or an array of pointers to characters.  (We can't
  32. tell, and we don't care; it's not our business.)  In either case,
  33. argv is passed to main() as a char **, which the alternate
  34. declaration char *argv[] is compatible with.
  35.  
  36. It's true, if argv up in main's caller were an array of arrays of
  37. characters, then it would be passed to main() as a pointer to
  38. arrays of characters (char (*)[N], or equivalently char [][N])
  39. which would be (and is) quite a different animal (especially
  40. since keeping track of the value of N would be a terrible,
  41. terrible nuisance).
  42.  
  43.                     Steve Summit
  44.                     scs@eskimo.com
  45.  
  46. February 8, 1996: A dark day for the net
  47.